﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		DexterPatternsAppliersHolder.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            DexterPatternsAppliersHolder.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using System.Collections.Generic;
using System.Reflection;
using ConfOrm;
using ConfOrm.NH;
using ConfOrm.Patterns;
using ConfOrm.Shop.CoolNaming;
using ConfOrm.Shop.NamingAppliers;
using NHibernate.Mapping.ByCode;

namespace Dexter.Repository.NHibernate.ConfORM.DexterNaming {
	internal class DexterPatternsAppliersHolder : EmptyPatternsAppliersHolder {
		/// <summary>
		/// 	Initializes a new instance of the <see cref = "DexterPatternsAppliersHolder" /> class.
		/// </summary>
		/// <param name = "domainInspector">The domain inspector.</param>
		public DexterPatternsAppliersHolder ( IDomainInspector domainInspector ) {
			if ( domainInspector == null ) {
				throw new ArgumentNullException ( "domainInspector" );
			}

			base.rootClass = new List <IPatternApplier <Type , IClassAttributesMapper>> ( );
			base.joinedSubclass = new List <IPatternApplier <Type , IJoinedSubclassAttributesMapper>> {
				new JoinedSubclassOnDeleteApplier ( ) ,
				new JoinedSubclassKeyAsRootIdColumnApplier ( domainInspector )
			};
			base.subclass = new List <IPatternApplier <Type , ISubclassAttributesMapper>> ( );
			base.unionSubclass = new List <IPatternApplier <Type , IUnionSubclassAttributesMapper>> ( );
			base.poid = new List <IPatternApplier <MemberInfo , IIdMapper>> {
				new MemberNoSetterToFieldAccessorApplier <IIdMapper> ( ) ,
				new NoPoidGuidApplier ( ) ,
				new BidirectionalOneToOneAssociationPoidApplier ( domainInspector )
			};
			base.property = new List <IPatternApplier <MemberInfo , IPropertyMapper>> {
				new MemberReadOnlyAccessorApplier <IPropertyMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <IPropertyMapper> ( ) ,
				new MemberToFieldAccessorApplier <IPropertyMapper> ( ) ,
			};
			base.propertyPath = new List <IPatternApplier <PropertyPath , IPropertyMapper>> {
				new ComponentPropertyColumnNameApplier ( ) ,
			};
			base.collection = new List <IPatternApplier <MemberInfo , ICollectionPropertiesMapper>> {
				new MemberReadOnlyAccessorApplier <ICollectionPropertiesMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <ICollectionPropertiesMapper> ( ) ,
				new MemberToFieldAccessorApplier <ICollectionPropertiesMapper> ( ) ,
				new BidirectionalOneToManyCascadeApplier ( domainInspector ) ,
				new BidirectionalOneToManyInverseApplier ( domainInspector ) ,
				new BidirectionalOneToManyOnDeleteConstraintApplier ( domainInspector ) ,
				new BidirectionalManyToManyInverseApplier ( domainInspector ) ,
			};

			base.collectionPath = new List <IPatternApplier <PropertyPath , ICollectionPropertiesMapper>> {
				new ManyToManyInCollectionTableApplier ( domainInspector ) ,
				new ManyToManyKeyIdColumnApplier ( domainInspector ) ,
				new OneToManyKeyColumnApplier ( domainInspector ) ,
				new CollectionOfElementsTableApplier ( domainInspector ) ,
				new CollectionOfElementsKeyColumnApplier ( domainInspector ) ,
				new CollectionOfComponentsTableApplier ( domainInspector ) ,
				new CollectionOfComponentsKeyColumnApplier ( domainInspector ) ,
			};
			base.listPath = new List <IPatternApplier <PropertyPath , IListPropertiesMapper>> {
				new ListIndexAsPropertyPosColumnNameApplier ( ) ,
			};
			base.manyToOne = new List <IPatternApplier <MemberInfo , IManyToOneMapper>> {
				new MemberReadOnlyAccessorApplier <IManyToOneMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <IManyToOneMapper> ( ) ,
				new MemberToFieldAccessorApplier <IManyToOneMapper> ( ) ,
				new BidirectionalForeignKeyAssociationManyToOneApplier ( domainInspector ) ,
				new UnidirectionalOneToOneUniqueCascadeApplier ( domainInspector )
			};
			base.manyToOnePath = new List <IPatternApplier <PropertyPath , IManyToOneMapper>> {
				new ManyToOneColumnApplier ( )
			};
			base.oneToOne = new List <IPatternApplier <MemberInfo , IOneToOneMapper>> {
				new MemberReadOnlyAccessorApplier <IOneToOneMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <IOneToOneMapper> ( ) ,
				new MemberToFieldAccessorApplier <IOneToOneMapper> ( ) ,
				new BidirectionalForeignKeyAssociationOneToOneApplier ( domainInspector ) ,
				new BidirectionalPrimaryKeyAssociationMasterOneToOneApplier ( domainInspector ) ,
				new BidirectionalPrimaryKeyAssociationSlaveOneToOneApplier ( domainInspector )
			};
			base.oneToOnePath = new List <IPatternApplier <PropertyPath , IOneToOneMapper>> ( );
			base.any = new List <IPatternApplier <MemberInfo , IAnyMapper>> {
				new MemberReadOnlyAccessorApplier <IAnyMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <IAnyMapper> ( ) ,
				new MemberToFieldAccessorApplier <IAnyMapper> ( )
			};
			base.anyPath = new List <IPatternApplier <PropertyPath , IAnyMapper>> ( );
			base.manyToMany = new List <IPatternApplier <MemberInfo , IManyToManyMapper>> ( );
			base.manyToManyPath = new List <IPatternApplier <PropertyPath , IManyToManyMapper>> {
				new ManyToManyColumnApplier ( domainInspector ) ,
			};
			base.componentParent = new List <IPatternApplier <MemberInfo , IComponentParentMapper>> {
				new MemberNoSetterToFieldAccessorApplier <IComponentParentMapper> ( ) ,
				new MemberToFieldAccessorApplier <IComponentParentMapper> ( ) ,
			};
			base.componentProperty = new List <IPatternApplier <MemberInfo , IComponentAttributesMapper>> {
				new MemberReadOnlyAccessorApplier <IComponentAttributesMapper> ( ) ,
				new MemberNoSetterToFieldAccessorApplier <IComponentAttributesMapper> ( ) ,
				new MemberToFieldAccessorApplier <IComponentAttributesMapper> ( )
			};
		}
	}
}
